package com.dexilaonian;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.multidex.MultiDex;

import com.mob.MobSDK;
import com.zhy.http.okhttp.OkHttpUtils;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Created by Administrator on 2017/6/14.
 */

public class MyApplication extends Application {
    public static Context applicationContext;
    public static MyApplication instance;
    private static SharedPreferences sp;

    public static String city ; //城市
    public static String cityCode ; //城市code
    public static String pervier; //省市
    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;
        applicationContext = this;
        sp = PreferenceManager.getDefaultSharedPreferences(this);
        // 如果希望在读取通信录的时候提示用户，可以添加下面的代码，并且必须在其他代码调用之前，否则不起作用；如果没这个需求，可以不加这行代码
        //SMSSDK.setAskPermisionOnReadContact(boolShowInDialog);
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
//                .addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                //其他配置
                .build();

        OkHttpUtils.initClient(okHttpClient);
       // MobSDK.init(this);
    }

    public static MyApplication getInstance() {
        return instance;
    }
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base); MultiDex.install(this);
    }

    public static Context getContext() {
        return applicationContext;
    }

}
